package com.xucy.springboot.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.*;

/**
 * @Author xucy
 * @Date 2019-07-16 10:46
 * @Description
 **/

public class TestUtil {
    public static Map map=new HashMap();
    public static int num=1;
    static {
        //高端人才
        map.put("025001", "高层次人才");
        map.put("025002", "留学人员归国创业");
        map.put("025003", "博士后工作站");
        map.put("025004", "创新创业基地");
    }
    public static void main(String[] args) {
//        test2();
        Random random=new Random();
        System.out.println(random.nextInt(25));


    }


    public static void test1(){
        FutureTask futureTask=new FutureTask(new Callable() {
            @Override
            public String call() throws Exception {
                System.out.println("执行上课吧");
                num++;
                System.out.println("执行上课吧"+num);
                return "上课了";
            }
        });
        BlockingQueue blockingQueue=new ArrayBlockingQueue(100);
        ThreadPoolExecutor threadPoolExecutor=new ThreadPoolExecutor(0,5,0, TimeUnit.SECONDS,
                blockingQueue);

        threadPoolExecutor.execute(futureTask);

        System.out.println("主"+num);
    }

    public static int[] test2(){

        int[] nums={1,3,5,4,7};
        int target=11;
        Map map=new HashMap();

        for(int i=0;i<nums.length;i++){
            if(map.containsKey(target-nums[i])){
                System.out.println(map.get(target-nums[i]));
                System.out.println(i);
                return new int[]{(int)map.get(target-nums[i]),i};
            }

            map.put(nums[i],i);
        }

        return null;
    }

    public void test3(){
        Thread thread=new Thread();
        thread.isInterrupted();
        thread.interrupt();
        Thread.interrupted();
        thread.start();
    }
}
